home *** CD-ROM | disk | FTP | other *** search
- Path: news.interport.net!usenet
- From: yaron@interport.net (Adi)
- Newsgroups: comp.lang.c++
- Subject: Re: #include"#include"thing.h""
- Date: Mon, 25 Mar 1996 07:35:02 GMT
- Organization: Interport Communications Corp.
- Message-ID: <4j580f$6ps@park.interport.net>
- References: <1996Mar23.150917.1@orion.alaska.edu>
- NNTP-Posting-Host: yaron.port.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- axmmm@orion.alaska.edu wrote:
-
- >Hello. I have a question.
-
- >Say I define a THING class. Once I do this, you see, I can create lots of
- >things.
-
- >But.
-
- >Each of these THINGs must contain a list of THINGs. Or so runs the theory.
- >I'm placing a bunch of THINGS in a doubly-linked list; but I want each of these
- >things to be able to (via a Thing.Search type function) scroll through the list
- >and look at all the other things.
-
- >So, essentially, I'm handing each Thing, in the list, a copy of the list with
- >all the things.
-
- >This is causing me problems when I try to compile, since in order to define a
- >class THINGLIST (which contains all the thing list manipulating functions), I
- >must define a Thing.
-
- >Which I did. But this Thing (as stated before) has a THINGLIST member in it.
- >Which is full of things, which are full of thinglists, which are full of...
-
-
- >Anyways; is it possible for me to do something like this? In the end I want a
- >bunch of things dynamically created at run time, and able to be placed in a
- >list of things. I also want to let each of the things in that list to be able
- >to look at all the other things in that list, so that they might (for instance)
- >place data in a selected thing's input buffer.
-
- >I've got code I could post to show you where I'm at; so if you could at all
- >help me (PLEASE!) email me at
-
- > pfennig@alaska.net
-
- > (That's my private account. I'm using my rock-slow university account
- >with a crappy newsreader I never use right now)
-
- >THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU in advance.
-
-
- Use a forward declaration like :
-
-
- class Thing;
-
- class ThingsList {
- .
- .
- .
- };
-
- class Thing {
- .
- .
- .
- };
-
-
- Or, if it does not fit your needs, try the opposite : make a forward
- declaration of ThingsList instead of the Thing.
-
-
- Adi
- NY
-
-
-